import mysql.connector

conn = mysql.connector.connect(
    host="localhost",
    port=3306,
    user="root",
    password="123456",
    database="testdb"
)

print("连接成功！")
conn.close()